package org.dromara.wms.domain;

import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.tenant.core.TenantEntity;

import java.io.Serial;
import java.util.List;

/**
 * BOM信息实体类
 *
 */

@Data
@EqualsAndHashCode(callSuper = true)
@TableName("wms_bom")
public class WmsBom extends TenantEntity {

  @Serial
  private static final long serialVersionUID = 1L;

  @TableId(value = "id", type = IdType.AUTO)
  @ExcelProperty(value = "主键")
  private Long id;

  @ExcelProperty(value = "清单名称")
  private String name;

  @ExcelProperty(value = "物品id")
  @NotNull(message = "物品id不能为空", groups = {AddGroup.class, EditGroup.class})
  private Long productId;

  @ExcelProperty(value = "物品耗时")
  private Long costTime;

  @ExcelProperty(value = "是否起")
  private String status;

  @ExcelProperty(value = "备注")
  private String remark;

//======================================其他字段

  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  @ExcelProperty(value = "物品名称")
  @TableField(exist = false)
  private String productName;

  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  @ExcelProperty(value = "物品id集合")
  @TableField(exist = false)
  private List<Long> productIds;

  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  @ExcelProperty(value = "物品明细")
  @TableField(exist = false)
  List<WmsBomLine> bomLine;

  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  @ExcelProperty(value = "物品工艺")
  @TableField(exist = false)
  List<WmsBomProcess> bomProcess;

  @TableField(exist = false)
  boolean isMaterial = true;

}
